/**
 * 告警模板
 */
import request from '@/utils/request';

// 列表数据查询
export function queryAlarmTemplateList(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmTemplate',
		method: 'post',
		data: query,
	});
}

// 根据id查询模板
export function queryAlarmTemplate(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmTemplate/' + id,
		method: 'get',
	});
}

//新增模板
export function addTemplate(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmTemplate/save',
		method: 'post',
		data: query,
	});
}

//修改模板
export function editTemplate(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmTemplate',
		method: 'put',
		data: query,
	});
}

//是否禁用
export function editTemplateEnable(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmTemplate/updateTemplateEnable',
		method: 'post',
		data: query,
	});
}

//根据ids批量删除模板
export function deleteTemplateByIds(query: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarmTemplate/delete/' + query,
		method: 'delete',
	});
}

//查询当前模板是否被告警引用到
export function queryAlarmByTemplateId(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/alarm/queryAlarmByTemplateId/' + id,
		method: 'get',
	});
}
